package com.shujia.mapreduce;


import java.io.InputStream;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Demo4NodeManager {
    public static void main(String[] args) throws Exception {

        //启动server，绑定一个端口
        ServerSocket serverSocket = new ServerSocket(8989);
        System.out.println("服务端已启动");

        Socket accept = serverSocket.accept();

        //获取输入流
        InputStream inputStream = accept.getInputStream();

        //对象输入流
        ObjectInputStream objectInputStream = new ObjectInputStream(inputStream);

        //获取客户端发送过来的task，强制转换成Thread
        Thread task = (Thread) objectInputStream.readObject();

        //启动客户端发送过来的task
        task.start();

    }
}
